﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<link type="text/css" rel="stylesheet" href="style/index.css">
<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/index_focus.js"></script>
</head>

<body>
<!--顶部开始-->
<div class="head">
	<div class="head_top">
    	<ul>
        	<li><a href="#">上网首页</a></li>
            <li><a href="#">影视</a></li>
            <li><a href="#">游戏</a></li>
            <li><a href="#">新闻</a></li>
            <li><a href="#">登陆</a></li>
            <li><a href="#">注册</a></li>
        </ul>
    </div>
</div>
<!--顶部结束-->

<!--网站logo和搜索框   开始-->
<div class="logo_search">
	<div class="logo_search_search">
    	<form>
        	<select>
            	<option value="新闻" selected="selected">新闻</option>
                <option value="视频">视频</option>
                <option value="网页">网页</option>
            </select>
        	<input type="text" class="logo_search_search_text" />
            <input type="submit" value="搜索" class="logo_search_search_submit"/>
        </form>
    </div>
</div>
<!--网站logo和搜索框   结束-->

<!--导航栏   开始-->
<div class="daohanglan">
	<ul>
    	<li><a href="#">首页</a></li>
        <li><a href="#">体育</a></li>
        <li><a href="#">娱乐</a></li>
    </ul>
</div>
<!--导航栏   结束-->

<!--其他新闻网站   开始-->
<div class="news_website">
	<ul class="news_website_ul1">
    	<li><a href="#">新浪新闻</a></li>
        <li><a href="#">凤凰资讯</a></li>
        <li><a href="#">腾讯新闻</a></li>
        <li><a href="#">搜狐新闻</a></li>
        <li><a href="#">网易新闻</a></li>
        <li><a href="#">百度新闻</a></li>
        <li><a href="#">新华网</a></li>
        <li><a href="#">人民网</a></li>
        <li><a href="#">CCTV新闻</a></li>
        <li><a href="#">中国新闻网</a></li>
    </ul>
    <ul class="news_website_ul2">
    	<li><a href="#">环球时报</a></li>
        <li><a href="#">联合早报</a></li>
        <li><a href="#">中国政府网</a></li>
        <li><a href="#">央广网</a></li>
        <li><a href="#">星岛环球网</a></li>
        <li><a href="#">参考消息</a></li>
        <li><a href="#">日经中文网</a></li>
        <li><a href="#">中国军网</a></li>
        <li><a href="#">大公网</a></li>
        <li><a href="#">中华网</a></li>
    </ul>
</div>
<!--其他新闻网站   结束-->

<!--新闻内容块1   开始-->
<div class="news_content1"><!--  清除浮动  开始-->
    <div style="clear:both">
    </div>
    <!--  清除浮动  结束-->
    <div id="main">
			<div class="cl">&nbsp;</div>
			
			<!-- Content -->
	  <div id="content">
				
				<!-- Box -->
		<div class="box">
					<!-- Box Head -->
<div class="box-head">
						<h2 class="left">待审核新闻</h2>
				   <!-- <div class="right" >
							<label>搜索</label>
							<input type="text" class="field small-field" />
							<input type="submit" class="button" value="search" />
						</div>
						-->
					</div>
					<!-- End Box Head -->	
					
					<!-- Table -->
					<div class="table">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<th width="13">&nbsp;</th>
								<th>标题</th>
								<th>日期</th>
								<th>作者</th>
								<th width="110" class="ac">操作</th>
							</tr>
							
						<?php
					    	$page=isset($_GET['page'])?intval($_GET['page']):1;
					    	
					    	$num=10;
					    	
							require_once("../connectMysql/connetMysql.class.php");
							
							$db=new connetMysql;
							$con=$db->getConnect();
							include 'chk.php';
							$total_num_sql="SELECT * FROM newsdraft WHERE newsstate=0";
							mysqli_query($con,$total_num_sql);
							$total=mysqli_affected_rows($con);
							$pagenum=ceil($total/$num);
							
							if($page <= 0){
								$page=1;
							}
							else if($page>$pagenum)
							{
								$page=$pagenum;
							}
							$startset=($page-1)*$num;
								
						if($total>0)
						{
							
							$sql = "SELECT * FROM newsdraft WHERE newsstate=0 ORDER BY newsid DESC LIMIT ".$startset.",".$num; 
							$result=mysqli_query($con,$sql);
							while ($row = mysqli_fetch_assoc($result))
							{
							    echo "<tr class='odd'>
									  	<td><input type='checkbox' class='checkbox' /></td>
            							<td><h3><a href='connect.php?newsid={$row['newsid']}'>{$row['newstitle']}</a></h3></td>
            							<td>{$row['newssubmittime']}</td>
            							<td><a href='#'>{$row['newsname']}</a></td>
            							<td><a href='#' class='ico del'>通过</a><a href='connect.php?newsid={$row['newsid']}' class='ico edit'>编辑</a></td>
            							</tr>
            						 ";
							}
						}
						else 
						{
							echo "<tr class='odd'>
									  	<td></td>
            							<td><h3>暂无更多</h3></td>
            							<td></td>
            							<td></td>
            							<td></td>
            							</tr>
            						 ";
						}
						?>							
						</table>
						
						
						<!-- Pagging -->
						<div class="pagging">
							
							<?php 
							echo"
								<div class='left'>当前显示第".$page."页记录，共".$total."条记录。</div>
								<div class='right'>
								";
							    $first=1;
							    $prev=$page-1;
							    $next=$page+1;
							    $last=$pagenum;	
							    if($page<3)	
							    {
							    	echo"
									<a href='?page=1'>首页</a>
									<a href='?page=".$prev."'>前一页</a>									
									<span>...</span>									
									<a href='?page=".$next."'>下一页</a>
									<a href='?page=".$last."'>尾页</a>
									";
							    }					   
								else 
									echo"
									<a href='?page=1'>首页</a>
									<a href='?page=".$prev."'>前一页</a>
									<a href='?page=".($page-2)."'>".($page-2)."</a>
									<a href='?page=".($page-1)."'>".($page-1)."</a>
									<a href='?page=".($page)."'>".($page)."</a>
									<span>...</span>
									<a href='?page=".($last-1)."'>".($last-1)."</a>
									<a href='?page=".$last."'>".$last."</a>									
									<a href='?page=".$next."'>下一页</a>
									<a href='?page=".$last."'>尾页</a>
									";
								
								$db->clossConnet();
							?>
								
							</div>
						</div>
						<!-- End Pagging -->
						
					</div>
					<!-- Table -->
					
		  </div>
		  <!-- End Box -->
				
		  <!-- Box --><!-- End Box -->

		</div>
			<!-- End Content -->
			
			
			
			<div class="cl">&nbsp;</div>			
		</div>
</div>
<!--新闻内容块1   结束-->
</body>
</html>
